import java.util.*;

/**
 * @Author 12629
 * @Description：
 */
class Person {
    public String id;

    public Person(String id) {
        this.id = id;
    }

    //重写 hashcode和equals方法

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return Objects.equals(id, person.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
public class Test {

    public static void main(String[] args) {
        HashMap<String,Integer> map = new HashMap<>(1000);
        map.put("abc",3);
    }

    public static void main3(String[] args) {
        Person person1 = new Person("1234");
        Person person2 = new Person("1234");

        HashBucket2<Person,String> hashBucket2 = new HashBucket2<>();
        hashBucket2.put(person1,"小美");
        String name = hashBucket2.get(person2);
        System.out.println(name);

    }
    public static void main2(String[] args) {
        Person person1 = new Person("1234");
        Person person2 = new Person("1234");

        System.out.println(person1.equals(person2));
        System.out.println("=======");
        System.out.println(person1.hashCode());
        System.out.println(person2.hashCode());

    }
    public static void main1(String[] args) {
        HashBucket hashBucket = new HashBucket();
        hashBucket.put(2,99);
        hashBucket.put(3,99);
        hashBucket.put(1,99);
        hashBucket.put(4,99);
        hashBucket.put(14,99);
        hashBucket.put(24,99);
        hashBucket.put(7,99);
        hashBucket.put(8,899);

        System.out.println(hashBucket.get(8));
    }


    public int singleNumber(int[] nums) {
        Set<Integer> set = new HashSet<>();

        for(int i = 0;i < nums.length;i++) {
            if(!set.contains(nums[i])) {
                set.add(nums[i]);
            }else {
                set.remove(nums[i]);
            }
        }

        for(int i = 0;i < nums.length;i++) {
            if(set.contains(nums[i])) {
                return nums[i];
            }
        }
        return -1;
    }

    /*public Node copyRandomList(Node head) {
        Map<Node,Node> map = new HashMap<>();
        //1.第一遍遍历链表
        Node cur = head;
        while(cur != null) {
            Node node = new Node(cur.val);
            map.put(cur,node);
            cur = cur.next;
        }
        //2.第2遍 遍历链表
        cur = head;
        while(cur != null) {
            map.get(cur).next = map.get(cur.next);
            map.get(cur).random = map.get(cur.random);
            cur = cur.next;
        }
        return map.get(head);
    }*/

    public int numJewelsInStones(String jewels, String stones) {
        Set<Character> set = new HashSet<>();
        for(int i = 0;i < jewels.length();i++) {
            char ch = jewels.charAt(i);
            set.add(ch);
        }

        int count = 0;
        for(int i = 0;i < stones.length();i++) {
            char ch = stones.charAt(i);
            if(set.contains(ch)) {
                count++;
            }
        }
        return count;
    }

    public static void main4(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str1 = in.nextLine();//要求的
            String str2 = in.nextLine();//实际输出的
            func(str1,str2);
        }
    }

    private static void func(String str1,String str2) {
        Set<Character> set = new HashSet<>();

        for(char ch : str2.toUpperCase().toCharArray()) {
            set.add(ch);
        }

        Set<Character> setBroken = new HashSet<>();
        for(char ch : str1.toUpperCase().toCharArray()) {
            if(!set.contains(ch) && !setBroken.contains(ch)) {
                System.out.print(ch);
                setBroken.add(ch);
            }
        }
    }
}
